import React from 'react'
// ===================================================================== Temp
import FormModal from '#cpt/temp/FormModal'
// ===================================================================== global declare
const { $fn } = window
// ===================================================================== data
const AuditStatus = [{ name:'是', value: '1' }, { name:'否', value:'0' }]
// ===================================================================== component
class Index extends React.Component{
	state = {
		data: [],
		// 条码作废
		formData:[
			{ label:'审核是否通过',		name: 'status', 		type: 'radio', 	full:true, 	value:'1', data:AuditStatus, 
				onValue:({value,formData})=>{
					$fn.getRow(formData, 'reason').required = +value ? false : true
					this.setState({formData})
				}
			},
			{ label: '原因', 			name:'reason', 		full:true, 	type:'textarea',	required:false },
		],
	}
	submit = {}
	open = (uuids)=> {
		const { formData } = this.state
		this.submit = {uuid:uuids}
		this.formRef.setValue({'status':'1'})
		$fn.getRow(formData, 'reason').required = false
		this.setState({formData})
		this.modal.open({formRef: this.formRef})
	}
	
	render(){
		return FormModal.call(this, {title:'审核', labelWidth:'s6', width:700, api:'bs-contract/exam', 
			onRefresh:()=> this.props.onRefresh(),
		} )
	}
}

export default Index